package com.xianggu.register;

import java.util.HashMap;
import java.util.Map;

/**
 * @author chengjy
 * @date 2025/3/8
 */
public class RegisterBeanCont {

    private static Map<String, Class> registerBeanMap = new HashMap<>();

    public static void register(String interfaceName , Class clazz, String version) {
        version = version == null ? "1.0" : version;
        String key = String.format("%s:%s", interfaceName, version);
        registerBeanMap.put( key, clazz);
    }

    public static Class getBean(String interfaceName, String version) {
        version = version == null ? "1.0" : version;
        String key = String.format("%s:%s", interfaceName, version);
        return registerBeanMap.get(key);
    }
}
